<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>jQuery的选择器-普通选择器</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>

<div id="box">
    <ul>
        <li class="fruit">苹果</li>
        <li class="vg">西红柿</li>
        <li class="vg">黄瓜</li>
        <li class="fruit">草莓</li>
        <li class="vg">土豆</li>
        <li class="fruit">葡萄</li>
        <li class="vg">南瓜</li>
        <li class="vg">香菇</li>
    </ul>

    <ul>
        <li>牛奶</li>
        <li>面包</li>
        <li>香肠</li>
        <li>鸡蛋</li>
    </ul>
</div>

<script>
    $(function(){
        $("#box").css("width","600px").css("height","auto").css("background-color","#CCFFFF").css("margin","0px auto");
        $("ul li").css("list-style","none");
        $(".fruit").css("color","green").css("font-weight","bold");
        $("ul:first li:even").css("background-color","#FFFFCC");
        $("ul:first li:odd").css("background-color","#99CCCC");
    })
</script>
</body>
</html>

